package com.sets;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import com.root.Person;

public class PersonSet {
	
	private Person person;

	public static void main(String[] args) {

		Set<Person> personSet = new HashSet<Person>();

		Person person = new Person();
		person.setName("RAM");
		person.setId("1");
		personSet.add(person);

		person = new Person();
		person.setName("LAXMAN");
		person.setId("1");
		personSet.add(person);

		for (Iterator<Person> iterator = personSet.iterator(); iterator
				.hasNext();) {
			Person personObj = iterator.next();

			System.out.println(personObj.getName());

		}

	}
	
 
	@Override
	protected void finalize() throws Throwable {
		 
		person= null;
	}
	
}
